package cn.iocoder.yudao.module.infra.api.ocr;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.infra.api.ocr.dto.OcrRecognizeRespDTO;
import cn.iocoder.yudao.module.infra.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.constraints.NotNull;

/**
 * OCR API 接口
 *
 * @author 芋道源码
 */
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - OCR")
public interface OcrApi {

    String PREFIX = ApiConstants.PREFIX + "/ocr";

    /**
     * 识别身份证
     *
     * @param configId OCR 配置 ID
     * @param fileId 文件 ID
     * @return OCR 识别结果
     */
    @PostMapping(PREFIX + "/recognize-id-card")
    @Operation(summary = "识别身份证")
    CommonResult<OcrRecognizeRespDTO> recognizeIdCard(@RequestParam("configId") @NotNull Long configId,
                                                      @RequestParam("fileId") @NotNull Long fileId);

    /**
     * 识别驾驶证
     *
     * @param configId OCR 配置 ID
     * @param fileId 文件 ID
     * @return OCR 识别结果
     */
    @PostMapping(PREFIX + "/recognize-driving-license")
    @Operation(summary = "识别驾驶证")
    CommonResult<OcrRecognizeRespDTO> recognizeDrivingLicense(@RequestParam("configId") @NotNull Long configId,
                                                              @RequestParam("fileId") @NotNull Long fileId);

    /**
     * 通用文本识别
     *
     * @param configId OCR 配置 ID
     * @param fileId 文件 ID
     * @return OCR 识别结果
     */
    @PostMapping(PREFIX + "/recognize-text")
    @Operation(summary = "通用文本识别")
    CommonResult<OcrRecognizeRespDTO> recognizeText(@RequestParam("configId") @NotNull Long configId,
                                                    @RequestParam("fileId") @NotNull Long fileId);

}